package com.prs.crm.domain.sys;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.annotation.DomainRelation;
import com.prs.crm.annotation.DomainRelations;
import com.prs.crm.domain.BaseEntity;

@Entity
@Table(name="sys_form")
@DomainRelations(relations={@DomainRelation(rely="com.prs.crm.domain.sys.Form",property="form")})
public class Form extends BaseEntity{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1556583254686899200L;

	@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;
	
	private String name;
	
	private String ename;
	
	private String className;
	
	@OneToMany(mappedBy="form")
	@OrderBy("sequence")
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
	private Set<FormField> fields = new HashSet<FormField>();
	
	@OneToMany(mappedBy="form")
	private Set<FormRelation> relations;
	
	private Boolean enforcement;
	
	@Lob
	private String remark;

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getId() {
		return id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setEname(String ename) {
		this.ename = ename;
	}

	public String getEname() {
		return ename;
	}

	public void setClassName(String className) {
		this.className = className;
	}

	public String getClassName() {
		return className;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getRemark() {
		return remark;
	}

	public void setFields(Set<FormField> fields) {
		this.fields = fields;
	}

	public Set<FormField> getFields() {
		return fields;
	}

	public void setEnforcement(Boolean enforcement) {
		this.enforcement = enforcement;
	}

	public Boolean getEnforcement() {
		return enforcement;
	}

	public void setRelations(Set<FormRelation> relations) {
		this.relations = relations;
	}

	public Set<FormRelation> getRelations() {
		return relations;
	}

}
